<extend name="Base/common"/>

<include file="Public/sider_right"/>


<block name="body">
<div class="index-ft">
    <ol class="breadcrumb">
        <li>杭州租房</li>
        <li class="active" id="select-area">{$area|getName='area'}租房</li>
    </ol>
    <ul class="select">
        <li class="select-list">
            <dl id="select1">
                <dt>区域：</dt>
                <dd args="0" class="select-all <if condition="0 eq $area">selected</if>"><a href="#">全部</a></dd>
                <volist name="area1" id="vo1" empty="暂时没有数据">

                    <dd
                    <if condition="$vo1['id'] eq $area">class="selected"</if>
                    args="{$vo1.id}"><a href="#">{$vo1.value}</a></dd>
                </volist>
            </dl>
        </li>
        <li class="select-list">
            <dl id="select2">
                <dt>租金：</dt>


                <dd  args="0" class="select-all  <if condition="0 eq $price">selected</if> "><a href="#">全部</a></dd>
                <volist name="price1" id="vo2" empty="暂时没有数据">
                    <dd
                    <if condition="$vo2['id'] eq $price">class="selected"</if>
                    args="{$vo2.id}"><a href="#">{$vo2.value}</a></dd>
                </volist>

            </dl>
        </li>

        <li class="select-list">
            <dl id="select3">
                <dt>方式：</dt>

                <dd args="0" class="select-all   <if condition="0 eq $style">selected</if>"><a href="#">全部</a></dd>
                <volist name="style1" id="vo3" empty="暂时没有数据">
                    <dd
                    <if condition="$vo3['id'] eq $style">class="selected"</if>
                    args="{$vo3.id}"><a href="#">{$vo3.value}</a></dd>
                </volist>
            </dl>
        </li>

        <li class="select-list">
            <dl id="select4">
                <dt>朝向：</dt>
                <dd args="0" class="select-all   <if condition="0 eq $orientation">selected</if>"><a href="#">全部</a></dd>
                <volist name="orientation1" id="vo4" empty="暂时没有数据">
                    <dd
                    <if condition="$vo4['id'] eq $orientation">class="selected"</if>
                    args="{$vo4.id}"><a href="#">{$vo4.value}</a></dd>
                </volist>
            </dl>
        </li>

        <li class="select-list">
            <dl id="select5">
                <dt>类型：</dt>
                <dd args="0" class="select-all   <if condition="0 eq $mold">selected</if>"><a href="#">全部</a></dd>
                <volist name="mold1" id="vo5" empty="暂时没有数据">
                    <dd
                    <if condition="$vo5['id'] eq $mold">class="selected"</if>
                    args="{$vo5.id}"><a href="#">{$vo5.value}</a></dd>
                </volist>
            </dl>
        </li>

        <li class="select-result">
            <dl>
                <dt>已选条件：</dt>
                <php>if($area){</php>
                <dd class="selected" args="{$area}" id="selectA"><a href="#">{$area|getName='area'}</a></dd>
                <php>}</php>
                <php>if($price){</php>
                <dd class="selected" args="{$price}" id="selectB"><a href="#">{$price|getName='price'}</a></dd>
                <php>}</php>
                <php>if($style){</php>
                <dd class="selected" args="{$style}" id="selectC"><a href="#">{$style|getName='style'}</a></dd>
                <php>}</php>
                <php>if($orientation){</php>
                <dd class="selected" args="{$orientation}" id="selectD"><a href="#">{$orientation|getName='orientation'}</a></dd>
                <php>}</php>
                <php>if($mold){</php>
                <dd class="selected" args="{$mold}" id="selectE"><a href="#">{$mold|getName='mold'}</a></dd>


                <php>}else if(!$area &&!$style &&!$price &&!$orientation &&!$mold){</php>

                <dd class="select-no">暂时没有选择条件</dd>
                <php>}</php>
            </dl>
        </li>
    </ul>
</div>
<div class="index-content">
    <div class="left-content">
        <div class="left-tab">
            <span style="line-height: 40px;">共有&nbsp;<b>{$totalCount}</b>&nbsp;条信息满足你的要求</span>
        </div>
        <div class="left-info">
            <volist name="lists" id="vo" empty="暂时没有数据">
                <div class="info-mod">
                    <php> preg_match_all('/\[(.*?)\]/',$vo['photo'],$photo);
                    </php>
                    <div class="info-img pull-left"><a href="{:U('house/Index/chuzu_detail',array('id'=>$vo['id']))}"><img src="{$photo.1.0}"/></a></a><div style="width: 160px;height: 24px;background-color: #000000;z-index: 1;position: absolute;margin-top: 96px;alpha(opacity=60); opacity: 0.6;text-align: center">
                        <span class="count-photo"style="color: #ffffff;"> <php>echo count($photo['1'])</php> 图</span></div></div>

                    <div class="info-det pull-left">
                        <div class="info-title"><a href="{:U('house/Index/chuzu_detail',array('id'=>$vo['id']))}">{$vo.title}</a></span>
                        </div>

                        <div class="list-word">
                            <span class="list-word-col">
                                <i class="glyphicon glyphicon-home" style="color: #dddddd"></i>&nbsp;{$vo.village}</span>
                            <span class="list-word-col"><i class="glyphicon glyphicon-map-marker" style="color: #dddddd"></i>&nbsp;{$vo.position}</span>
                        </div>


                        <div class="list-word">
                            <span class="list-word-col">{$vo.type}</span>&nbsp;-&nbsp;
                            <span class="list-word-col">{$vo.area}㎡</span>&nbsp;-&nbsp;
                            <span class="list-word-col">{$vo.orientation}&nbsp;-{$vo.mold}&nbsp;</span>
                        </div>


                        <div class="list-word">
                            <span class="list-word-col">{$vo.nickname}&nbsp;于&nbsp;{$vo.time|time_format}&nbsp;发布</span>
                        </div>

                    </div>


                    <div class="price-box">
                        <span class="price">{$vo.price}</span><span>元/月</span>
                    </div>


                </div>


            </volist>
        </div>

        <div class="pull-right">

            {:getPagination($totalCount,$pagenum)}
        </div>

    </div>
    <div>
        <include file="Public/sider_right"/>
    </div>
    <script type="text/javascript" src="__STATIC__/jquery-1.7.2.min.js"></script>

    <!--条件筛选jQuery-->
    <script type="text/javascript">

        $(document).ready(function () {
            $("#select1 dd").click(function () {




                $(this).addClass("selected").siblings().removeClass("selected");
                if ($(this).hasClass("select-all")) {
                     $("#selectA").remove();
                } else {
                    var copyThisA = $(this).clone();
                    if ($("#selectA").length > 0) {
                        $("#selectA a").html($(this).text());
                        $("#selectA").attr('args', $(this).attr('args'));

                    } else {
                        $(".select-result dl").append(copyThisA.attr("id", "selectA"));

                    }

                }
                goTo();

            });

            $("#select2 dd").click(function () {
                $(this).addClass("selected").siblings().removeClass("selected");
                if ($(this).hasClass("select-all")) {
                    $("#selectB").remove();
                } else {
                    var copyThisB = $(this).clone();
                    if ($("#selectB").length > 0) {
                        $("#selectB a").html($(this).text());
                        $("#selectB").attr('args', $(this).attr('args'));
                    } else {
                        $(".select-result dl").append(copyThisB.attr("id", "selectB"));
                    }

                }goTo();
            });

            $("#select3 dd").click(function () {
                $(this).addClass("selected").siblings().removeClass("selected");
                if ($(this).hasClass("select-all")) {
                    $("#selectC").remove();
                } else {
                    var copyThisC = $(this).clone();
                    if ($("#selectC").length > 0) {
                        $("#selectC a").html($(this).text());
                        $("#selectC").attr('args', $(this).attr('args'));
                    } else {
                        $(".select-result dl").append(copyThisC.attr("id", "selectC"));
                    }

                }goTo();
            });

            $("#select4 dd").click(function () {
                $(this).addClass("selected").siblings().removeClass("selected");
                if ($(this).hasClass("select-all")) {
                    $("#selectD").remove();
                } else {
                    var copyThisD = $(this).clone();
                    if ($("#selectD").length > 0) {
                        $("#selectD a").html($(this).text());
                        $("#selectD").attr('args', $(this).attr('args'));
                    } else {
                        $(".select-result dl").append(copyThisD.attr("id", "selectD"));
                    }

                }goTo();
            });

            $("#select5 dd").click(function () {
                $(this).addClass("selected").siblings().removeClass("selected");
                if ($(this).hasClass("select-all")) {
                    $("#selectE").remove();
                } else {
                    var copyThisE = $(this).clone();
                    if ($("#selectE").length > 0) {
                        $("#selectE a").html($(this).text());
                        $("#selectE").attr('args', $(this).attr('args'));
                    } else {
                        $(".select-result dl").append(copyThisE.attr("id", "selectE"));
                    }

                }goTo();
            });

            $("#selectA").live("click", function () {
                $(this).remove();
                $("#select1 .select-all").addClass("selected").siblings().removeClass("selected");
                goTo();
            });

            $("#selectB").live("click", function () {
                $(this).remove();
                $("#select2 .select-all").addClass("selected").siblings().removeClass("selected");
                goTo();
            });

            $("#selectC").live("click", function () {
                $(this).remove();
                $("#select3 .select-all").addClass("selected").siblings().removeClass("selected");
                goTo();
            });

            $("#selectD").live("click", function () {
                $(this).remove();
                $("#select4 .select-all").addClass("selected").siblings().removeClass("selected");
                goTo();
            });

            $("#selectE").live("click", function () {
                $(this).remove();
                $("#select5 .select-all").addClass("selected").siblings().removeClass("selected");
                goTo();
            });

            $(".select dd").live("click", function () {
                if ($(".select-result dd").length > 1) {
                    $(".select-no").hide();
                } else {
                    $(".select-no").show();
                }
            });




        });


        function goTo() {
            if (typeof($('#selectA').attr('args')) == 'undefined') {
                var area = 0;
            }
            else {
                var area = $('#selectA').attr('args')
            }
            if (typeof($('#selectB').attr('args')) == 'undefined') {
                var price = 0;
            }
            else {
                var price = $('#selectB').attr('args')
            }

            if (typeof($('#selectC').attr('args')) == 'undefined') {
                var style = 0;
            }
            else {
                var style = $('#selectC').attr('args')
            }

            if (typeof($('#selectD').attr('args')) == 'undefined') {
                var orientation = 0;
            }
            else {
                var orientation = $('#selectD').attr('args')
            }

            if (typeof($('#selectE').attr('args')) == 'undefined') {
                var mold = 0;
            }
            else {
                var mold = $('#selectE').attr('args')
            }

            location.href = U('house/Index/index&area=' + area + '&price=' + price + '&style=' + style + '&orientation=' + orientation + '&mold=' + mold + '&page={$page}','',true);

        }
        (function() {
            var $backToTopTxt = "返回顶部", $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body"))
                    .text($backToTopTxt).attr("title", $backToTopTxt).click(function() {
                        $("html, body").animate({ scrollTop: 0 }, 120);
                    }), $backToTopFun = function() {
                var st = $(document).scrollTop(), winh = $(window).height();
                (st > 0)? $backToTopEle.show(): $backToTopEle.hide();
                //IE6下的定位
                if (!window.XMLHttpRequest) {
                    $backToTopEle.css("top", st + winh - 166);
                }
            };
            $(window).bind("scroll", $backToTopFun);
            $(function() { $backToTopFun(); });
        })();


    </script>


</block>
